package com.tjsoft.system.web.account;

import java.util.List;

import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.PropertyFilter;
import org.springside.modules.utils.web.struts2.Struts2Utils;

import com.tjsoft.system.entity.base.Report;
import com.tjsoft.system.service.AccountManager;
import com.tjsoft.system.web.CrudActionSupport;

//namespace与application下的目录对应dispatcher
@Namespace("/app/sys/report")
public class ReportAction extends CrudActionSupport<Report> {

	private static final long serialVersionUID = 8683878162525847072L;

	@Autowired
	private AccountManager accountManager;

	private Long id ;
	private Report entity;
	private Page<Report> page = new Page<Report>(10);
	
	@Override
	public String delete()  {
		return RELOAD;
	}
	@Override
	public String input()  {
		return INPUT;
	}
	
	@Override
	public String list() {
		try {
			List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(Struts2Utils.getRequest());
			page.setOrderBy("govmoney,selfmoney");
			page.setOrder("desc,desc");
			page = accountManager.findPageReport(page, filters);
		} catch (Exception e) {
			logger.error(e.getMessage(),e);
			addActionMessage("加载报表失败");
		}
		return "list";
	}
	@Override
	protected void prepareModel()  {
	}
	@Override
	public String save()  {
		return RELOAD;
	}
	
	public Report getModel() {
		return entity;
	}
	
	//＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝
	public AccountManager getAccountManager() {
		return accountManager;
	}
	
	public void setAccountManager(AccountManager accountManager) {
		this.accountManager = accountManager;
	}
	public Page<Report> getPage() {
		return page;
	}
	public void setPage(Page<Report> page) {
		this.page = page;
	}
	public Report getEntity() {
		return entity;
	}
	public void setEntity(Report entity) {
		this.entity = entity;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}

}
